<?PHP
if (!session_start()) { session_start(); };
/*if (!isset($_SESSION['lgnapproved'])) {
	die(header('Location: login.php'));
}*/
include("functions.php");
include("cnnxn.php");
connect();

$SQLview='SELECT * FROM Players ORDER BY LastName ASC, FirstName ASC;';
//print $SQLview;
$sendit_view=mysqli_query($db,$SQLview) or die(mysqli_error($db));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>daleclark.net</title>
<link type="text/css" rel="stylesheet" href="adminstyles.css" />
</head>
<body>
<div id="adminwrapper">
<div id="adminlogo"></div>
<?PHP navigation(); ?>
<div id="admincontent">
<h3>Players</h3>

<div style="float:left; width:500px; padding-right:25px; margin-right:25px; border-right:1px solid #FFFFFF;">

<?PHP 
$backgroundcolor="#2883D4";
while ($RSview=mysqli_fetch_object($sendit_view)) {
	if ($backgroundcolor=="#2883D4") {
		$backgroundcolor="#2F93E9";
	} else {
		$backgroundcolor="#2883D4";
	}
print '<div style="background:'.$backgroundcolor.'; width:500px; padding:2px 2px 2px 5px;"><span class="deletespan"><a href="Players_del.php?pid='.$RSview->PlayerID.'" class="deletelink" title="DELETE" onclick="return confirm(\'Are sure you want to PERMANENTLY DELETE this Player?\')"><img src="../images/icon_delete.png" height="12px" border="0" /></a></span><span class="column01span"><a href="Players_mod.php?id='.$RSview->PlayerID.'">'.$RSview->LastName.', '.$RSview->FirstName.'</a>, <a href="mailto:'.$RSview->Email.'">'.$RSview->Email.'</a></span><div class="clear"></div></div>';
}
?>

<div class="clear"></div>
<p>&nbsp;</p>
</div>
<div style="float:left; width:500px;">

<h3>Add Player</h3>
<form name="addForm" method="POST" action="Players_add.php" enctype="multipart/form-data">
<p><span class="label">First Name</span><span class="inputbox"><input name="FirstName" type="text" value="<?PHP if (isset($_GET['fn'])) { print $_GET['fn']; } ?>" /></span></p>
<p><span class="label">Last Name</span><span class="inputbox"><input name="LastName" type="text" value="<?PHP if (isset($_GET['ln'])) { print $_GET['ln']; } ?>" /></span></p>
<p><span class="label">Phone</span><span class="inputbox"><input name="Phone" type="text" /></span></p>
<p><span class="label">Email</span><span class="inputbox"><input name="Email" type="text" /></span></p>
<p><span class="label">Gender</span><span class="inputbox"><select name="GenderID">
<?PHP 
$SQLgg='SELECT * FROM Gender;';
$sendgg=mysqli_query($db,$SQLgg) or die(mysqli_error($db));
while ($RSgg=mysqli_fetch_object($sendgg)) {
	print '<option value="'.$RSgg->GenderID.'">'.$RSgg->Gender.'</option>';
}
?>
</select></span></p>
<p><span class="label">Home Town</span><span class="inputbox"><input name="Hometown" type="text" /></span></p>
<p><span class="label">Current Town</span><span class="inputbox"><input name="CurrentTown" type="text" /></span></p>
<p><span class="label">Local Beach</span><span class="inputbox"><input name="LocalBeach" type="text" /></span></p>
<p><span class="label">Height</span><span class="inputbox"><input name="Height" type="text" /></span></p>
<p><span class="label">Picture</span><span class="inputbox"><input name="Picture" type="file" /></span></p>
<p><span class="label">College</span><span class="inputbox"><input name="College" type="text" /></span></p>
<p><span class="label">Is AVA Volunteer</span><span class="inputbox"><input name="IsAVAVolunteer" type="checkbox" value="1" /></span></p>
<p><span class="label">Current Played</span><span class="inputbox"><input name="CurrentPlayed" type="text" /></span></p>
<p><span class="label">Current Points</span><span class="inputbox"><input name="CurrentPoints" type="text" /></span></p>
<p><span class="label">Current Unadjusted Rating</span><span class="inputbox"><input name="CurrentUnadjustedRating" type="text" /></span></p>
<p><span class="label">Current Unadjusted Rating Date</span><span class="inputbox"><em>(format: yyyy-mm-dd eg: 2011-12-25)</em> <input name="CurrentUnadjustedRatingDate" type="text" /></span></p>
<input type="submit" value="submit" name="submit" />
</form>

</div>

</div>
</div>
</body>
</html>
<?PHP
mysqli_close($db);
?>